//
//  FootView.m
//  xjairOA
//
//  Created by apple on 16-1-13.
//  Copyright (c) 2016年 net. All rights reserved.
//

#import "FootView.h"

@implementation FootView

-(id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if(self){
        //self.backgroundColor = [UIColor orangeColor];
        self.activity = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
        self.activity.frame = CGRectMake(10, 0, 50, 70);
        [self addSubview:self.activity];
        self.infolabel = [[UILabel alloc]initWithFrame:CGRectMake(100,0 ,150, 70)];
        self.infolabel.text = @"上拉加载更多...";
        self.infolabel.font = [UIFont fontWithName:@"Helvetica" size:20];
        self.infolabel.textAlignment = NSTextAlignmentCenter;
        self.infolabel.textColor = [UIColor blackColor];
        [self addSubview:self.infolabel];
        
        //设置初始状态
        self.refreshState = RefreshStateNormal;
    }
    return self;
}

//初始状态
- (void)refreshStateNomal
{
    self.refreshState = RefreshStateNormal;
    [self.activity stopAnimating];
    self.infolabel.text = @"上拉加载更多...";
}

//正在请求数据时
- (void)refreshStateLoading
{
    self.refreshState = RefreshStateLoading;
    //[UIView beginAnimations:nil context:nil];
    self.infolabel.text = @"正在加载...";
    [self.activity startAnimating];
    //[UIView commitAnimations];
}

//下拉完成后
- (void)refreshStateRelsease
{
    self.refreshState = RefreshStateRelease;
    //[UIView beginAnimations:nil context:nil];
    self.infolabel.text = @"释放后加载...";
    //[UIView commitAnimations];
    
}
@end
